#ifndef SHARE_OOPS_CONSTMETHOD_HPP
#define SHARE_OOPS_CONSTMETHOD_HPP

#include "utilities/globalDefinitions.h"

class ConstMethod {

private:
    u2                _code_size;
    u2                _name_index;                 // Method name (index in constant pool)
    u2                _signature_index;            // Method signature (index in constant pool)
    u2                _method_idnum;               // unique identification number for the method within the class
                                                   // initially corresponds to the index into the methods array.
                                                   // but this may change with redefinition
    u2                _max_stack;                  // Maximum number of entries on the expression stack
    u2                _max_locals;                 // Number of local variables used by this method
    u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
public:
    static ConstMethod* allocate(int byte_code_size);

    address code_base(){
        return (address)(this +1);
    }

    void set_code_size(u2 code_size) { _code_size = code_size;}
    u2 code_size() {return _code_size;}

    // byte codes
    void    set_code(address code) {
        if (code_size() > 0) {
            memcpy(code_base(), code, code_size());
        }
    }
};

#endif